package trip;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GenerationType;

@Entity
@Table(name = "STOP")
public class Stop {
	@Id
	@Column(name = "id")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;

	@Column(name = "stop_name", nullable = false, length = 20)
	private String name;

	//constructors
	public Stop() {};
	
	public Stop(long id, String name) {
		this.id = id;
		this.name = name;
	}	

	//id
	public long getId() {
		return id;
	}

	public Stop setId(long id) {
		this.id = id;
		return this;
	}

	//name
	public String getName() {
		return name;
	}

	public Stop setName(String name) {
		this.name = name;
		return this;
	}
	
	public boolean equals(Stop stop) {
		if (stop == null)
			return false;
		if (this.id == stop.id && 
			this.name.equalsIgnoreCase(stop.name))
			return true;
		else
			return false;
	}
}